package org.webdb.jdbc;

public interface JDBCTableStore {

    public static class TableKey implements Comparable<TableKey> {

        private String name;
        private String schema;

        public TableKey(String schemaName, String tableName) {
            this.schema = schemaName;
            this.name = tableName;
        }

        public int compareTo(TableKey o) {
            if (o == this)
                return 0;

            int c = schema.compareTo(o.schema);
            return (c != 0) ? c : name.compareTo(o.name);
        }

        @Override
        public String toString() {
            return TableKey.class.getSimpleName() + "[" + schema + "." + name
                    + "]";
        }

    }

    public JDBCTable retrieve(String schemaName, String tableName);

    public void store(JDBCTable table);

    public void store(TableKey tableKey, JDBCTable jdbcTable);

}
